import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/balance_uCoin_bill_entity.dart';

BalanceUCoinBillEntity $BalanceUCoinBillEntityFromJson(
    Map<String, dynamic> json) {
  final BalanceUCoinBillEntity balanceUCoinBillEntity = BalanceUCoinBillEntity();
  final List<BalanceUCoinBillList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<BalanceUCoinBillList>(e) as BalanceUCoinBillList)
      .toList();
  if (list != null) {
    balanceUCoinBillEntity.list = list;
  }
  final int? page = jsonConvert.convert<int>(json['page']);
  if (page != null) {
    balanceUCoinBillEntity.page = page;
  }
  final int? pageSize = jsonConvert.convert<int>(json['pageSize']);
  if (pageSize != null) {
    balanceUCoinBillEntity.pageSize = pageSize;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    balanceUCoinBillEntity.total = total;
  }
  return balanceUCoinBillEntity;
}

Map<String, dynamic> $BalanceUCoinBillEntityToJson(
    BalanceUCoinBillEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  data['page'] = entity.page;
  data['pageSize'] = entity.pageSize;
  data['total'] = entity.total;
  return data;
}

extension BalanceUCoinBillEntityExt on BalanceUCoinBillEntity {
  BalanceUCoinBillEntity copyWith({
    List<BalanceUCoinBillList>? list,
    int? page,
    int? pageSize,
    int? total,
  }) {
    return BalanceUCoinBillEntity()
      ..list = list ?? this.list
      ..page = page ?? this.page
      ..pageSize = pageSize ?? this.pageSize
      ..total = total ?? this.total;
  }
}

BalanceUCoinBillList $BalanceUCoinBillListFromJson(Map<String, dynamic> json) {
  final BalanceUCoinBillList balanceUCoinBillList = BalanceUCoinBillList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    balanceUCoinBillList.id = id;
  }
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    balanceUCoinBillList.createdAt = createdAt;
  }
  final int? outIn = jsonConvert.convert<int>(json['outIn']);
  if (outIn != null) {
    balanceUCoinBillList.outIn = outIn;
  }
  final int? amount = jsonConvert.convert<int>(json['amount']);
  if (amount != null) {
    balanceUCoinBillList.amount = amount;
  }
  final int? year = jsonConvert.convert<int>(json['year']);
  if (year != null) {
    balanceUCoinBillList.year = year;
  }
  final int? month = jsonConvert.convert<int>(json['month']);
  if (month != null) {
    balanceUCoinBillList.month = month;
  }
  final int? day = jsonConvert.convert<int>(json['day']);
  if (day != null) {
    balanceUCoinBillList.day = day;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    balanceUCoinBillList.type = type;
  }
  final String? userId = jsonConvert.convert<String>(json['userId']);
  if (userId != null) {
    balanceUCoinBillList.userId = userId;
  }
  final String? withalRecordId = jsonConvert.convert<String>(
      json['withalRecordId']);
  if (withalRecordId != null) {
    balanceUCoinBillList.withalRecordId = withalRecordId;
  }
  final int? deletedAt = jsonConvert.convert<int>(json['deletedAt']);
  if (deletedAt != null) {
    balanceUCoinBillList.deletedAt = deletedAt;
  }
  final int? withdrawState = jsonConvert.convert<int>(json['withdrawState']);
  if (withdrawState != null) {
    balanceUCoinBillList.withdrawState = withdrawState;
  }
  return balanceUCoinBillList;
}

Map<String, dynamic> $BalanceUCoinBillListToJson(BalanceUCoinBillList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['createdAt'] = entity.createdAt;
  data['outIn'] = entity.outIn;
  data['amount'] = entity.amount;
  data['year'] = entity.year;
  data['month'] = entity.month;
  data['day'] = entity.day;
  data['type'] = entity.type;
  data['userId'] = entity.userId;
  data['withalRecordId'] = entity.withalRecordId;
  data['deletedAt'] = entity.deletedAt;
  data['withdrawState'] = entity.withdrawState;
  return data;
}

extension BalanceUCoinBillListExt on BalanceUCoinBillList {
  BalanceUCoinBillList copyWith({
    String? id,
    int? createdAt,
    int? outIn,
    int? amount,
    int? year,
    int? month,
    int? day,
    int? type,
    String? userId,
    String? withalRecordId,
    int? deletedAt,
    int? withdrawState,
  }) {
    return BalanceUCoinBillList()
      ..id = id ?? this.id
      ..createdAt = createdAt ?? this.createdAt
      ..outIn = outIn ?? this.outIn
      ..amount = amount ?? this.amount
      ..year = year ?? this.year
      ..month = month ?? this.month
      ..day = day ?? this.day
      ..type = type ?? this.type
      ..userId = userId ?? this.userId
      ..withalRecordId = withalRecordId ?? this.withalRecordId
      ..deletedAt = deletedAt ?? this.deletedAt
      ..withdrawState = withdrawState ?? this.withdrawState;
  }
}